import time
import keyboard

class Global:
    @staticmethod
    def play_or_pause_media():
        keyboard.send('play/pause media')

    @staticmethod
    def next_media():
        keyboard.send('next track')

    @staticmethod
    def previous_media():
        keyboard.send('previous track')

    @staticmethod
    def volume_up():
        keyboard.send('volume up')

    @staticmethod
    def volume_down():
        keyboard.send('volume down')

    @staticmethod
    def toggle_mute():
        keyboard.send('volume mute')


class StepLength:
    S=5
    M=30
    L=60
    XL=300
    
class Potplayer:
    @staticmethod
    def active():
        keyboard.send('ctrl+shift+p')
        time.sleep(.1)
    
    @staticmethod
    def pause_or_play():
        Potplayer.active()
        keyboard.send('space')
    
    @staticmethod
    def next_video():
        Potplayer.active()
        keyboard.send('page down')

    @staticmethod
    def previous_video():
        Potplayer.active()
        keyboard.send('page up')

    @staticmethod
    def step(forward:bool,length:StepLength=StepLength.S):
        Potplayer.active()
        dir='right' if forward else 'left'
        if length==StepLength.S:
            keyboard.send(f'{dir}')
        elif length==StepLength.M:
            keyboard.send(f'ctrl+{dir}')
        elif length==StepLength.L:
            keyboard.send(f'shift+{dir}')
        elif length==StepLength.XL:
            keyboard.send(f'ctrl+alt+{dir}')
    
    @staticmethod
    def replay():
        Potplayer.active()
        keyboard.send('backspace')

    @staticmethod
    def replay():
        Potplayer.active()
        keyboard.send('backspace')
        
    @staticmethod
    def speed_up():
        Potplayer.active()
        keyboard.send('c')

    @staticmethod
    def speed_down():
        Potplayer.active()
        keyboard.send('x')

    @staticmethod
    def reset_speed():
        Potplayer.active()
        keyboard.send('z')

    @staticmethod
    def volume_down():
        Potplayer.active()
        keyboard.send('down')

    @staticmethod
    def volume_up():
        Potplayer.active()
        keyboard.send('up')

    @staticmethod
    def toggle_mute():
        Potplayer.active()
        keyboard.send('m')
    
    @staticmethod
    def toggle_full_screen():
        Potplayer.active()
        keyboard.send('alt+enter')
    
    # @staticmethod
    # def exit():
    #     Potplayer.active()
    #     keyboard.send('alt+f4')

if __name__ == '__main__':
    Potplayer.reset_speed()